package com.fengye.algorithms.huawei;

import java.util.Scanner;

/**
 * https://www.nowcoder.com/practice/2aa32b378a024755a3f251e75cbf233a?tpId=37&tqId=21252&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 * @Author fengye
 * @Date 2023/4/7 10:42
 **/
public class StringEncode {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) {
            String enc = in.next();
            String dec = in.next();

            char[] encChars = enc.toCharArray();
            StringBuilder encSb = new StringBuilder();
            int shift = 'a' - 'A';
            for (char c : encChars) {
                if (isLowerCase(c)) {
                    if (c == 'z') {
                        encSb.append('A');
                    } else {
                        encSb.append((char)(c - shift + 1));
                    }
                } else if (isUpperCase(c)) {
                    if (c == 'Z') {
                        encSb.append('a');
                    } else {
                        encSb.append((char)(c + shift + 1));
                    }
                } else if (isDigit(c)) {
                    if (c == '9') {
                        encSb.append('0');
                    } else {
                        encSb.append((char) (c + 1));
                    }
                } else {
                    encSb.append(c);
                }
            }

            char[] decChars = dec.toCharArray();
            StringBuilder decSb = new StringBuilder();
            for (char c : decChars) {
                if (isLowerCase(c)) {
                    if (c == 'a') {
                        decSb.append('Z');
                    } else {
                        decSb.append((char)(c - 1 - shift));
                    }
                } else if (isUpperCase(c)) {
                    if (c == 'A') {
                        decSb.append('z');
                    } else {
                        decSb.append((char) (c - 1 + shift));
                    }
                } else if (isDigit(c)) {
                    if (c == '0') {
                        decSb.append('9');
                    } else {
                        decSb.append((char) (c - 1));
                    }
                } else {
                    decSb.append(c);
                }
            }
            System.out.println(encSb.toString());
            System.out.println(decSb.toString());
        }
    }

    public static boolean isLowerCase(char ch) {
        if (ch >= 'a' && ch <= 'z') {
            return true;
        }
        return false;
    }

    public static boolean isUpperCase(char ch) {
        if (ch >= 'A' && ch <= 'Z') {
            return true;
        }
        return false;
    }

    public static boolean isDigit(char ch) {
        if (ch >= '0' && ch <= '9') {
            return true;
        }
        return false;
    }
}
